{include file="header.html"}
<script type="text/javascript">
//<!CDATA[
$(function(){
    $('#add_time_from').datepicker({dateFormat: 'yy-mm-dd'});
    $('#add_time_to').datepicker({dateFormat: 'yy-mm-dd'});
    // multi-select mall_gcategory
    $('#gcategory').length>0 && gcategoryInit("gcategory");
});
//]]>

/*onmouseover="effectMOver('tatr2',event)" onmouseout="effectMOut('tatr2',event)" onclick="effectClick('tr',event)"*/
// function effectMOver(className, event) {
//   var target = $(event.target);
//   if (target.parent().hasClass(className)) {
//     target.parent().addClass('effectBg');
//   }
// }
// function effectMOut(className, event) {
//   var target = $(event.target);
//   if (target.parent().hasClass(className)) {
//     target.parent().removeClass('effectBg');
//   }
// }
// function effectClick(par, event) {
//   var target = $(event.target);
//   if (target.is('a')) {
//     target.closest(par).siblings(par).removeClass('effectClick').end().addClass('effectClick');
//   }
// }

</script>
<div id="rightTop">
  <p>{$lang.goods}</p>
  <ul class="subnav">
    <li>
      <!--{if $smarty.get.closed}-->
      <a class="btn1" href="index.php?app=goods">{$lang.all_goods}</a>
      <!--{else}-->
      <span>{$lang.all_goods}</span>
      <!--{/if}--> 
    </li>
    <li>
      <!--{if $smarty.get.closed}-->
      <span>{$lang.closed}</span>
      <!--{else}-->
      <a class="btn1" href="index.php?app=goods&amp;closed=1">{$lang.closed}</a>
      <!--{/if}--> 
    </li>
    <li><a class="btn4" href="index.php?app=goods&amp;act=import_place">推入场景分类</a></li>
  </ul>
</div>
<div class="mrightTop1 info">
  <div class="fontl">
    <form method="get">
      <input type="hidden" name="app" value="goods" />
      <!--{if $smarty.get.closed}-->
      <input type="hidden" name="closed" value="1" />
      <!--{/if}-->
      {$lang.goods_name}:
      <input class="queryInput" type="text" name="goods_name" value="{$smarty.get.goods_name|escape}" />
      商品ID:
      <input class="queryInput" type="text" name="goods_id" value="{$smarty.get.goods_id|escape}" />
      {$lang.store_name}:
      <input class="queryInput" type="text" name="store_name" value="{$smarty.get.store_name|escape}" />
      {$lang.brand}:
      <input class="queryInput" type="text" name="brand" value="{$smarty.get.brand|escape}" />
      <select class="querySelect" name="if_show">
        <option value="">{$lang.if_show}</option>
        {html_options options=$show_options selected=$query.if_show}
      </select>
      是否为特色商品:
      <select class="querySelect" name="is_feature">
        <option value="">--请选择--</option>
        {html_options options=$feature_options selected=$query.is_feature}
      </select>
        是否促销商品:
        <select class="querySelect" name="act_id">
            <option value="">--全部--</option>
            <option value="1" {if $query.act_id eq 1}selected{/if}>促销商品</option>
        </select>
      {$lang.add_time_from}:
      <input class="queryInput" type="text" id="add_time_from" value="{$query.add_time_from}" name="add_time_from" class="pick_date" />
      {$lang.add_time_to}:
      <input class="queryInput" type="text" id="add_time_to" value="{$query.add_time_to}" name="add_time_to" class="pick_date" />
      <br />
      <span style="position: relative; top: 5px;">
        <div class="left">
          场景分类名:
          <div id="placecategory" style="display:inline;">
            <select name="placecate_id" class="querySelect">
              <option>{$lang.select_pls}</option>
              {html_options options=$placecategories selected=$smarty.get.placecate_id}
            </select>
          </div>
        </div>
      </span>
      
      <span style="position: relative; top: 5px;">
        <div class="left">
          {$lang.gcategory}:
          <div id="gcategory" style="display:inline;">
            <input type="hidden" name="cate_id" value="0" class="mls_id" />
            <select class="querySelect">
              <option>{$lang.select_pls}</option>
              {html_options options=$gcategories}
            </select>
          </div>
          <input type="submit" class="formbtn" value="{$lang.query}" />
        </div>
        <!--{if $smarty.get.cate_id or $query.goods_name or $query.store_name or $query.brand or $smarty.get.placecate_id}-->
        <a class="left formbtn1" href="index.php?app=goods<!--{if $query.closed}-->
          &amp;closed={$query.closed}
          <!--{/if}-->">{$lang.cancel_query}</a>
        <!--{/if}--> 
      </span>
    </form>
  </div>
  <div class="fontr">{include file=page.top.html}</div>
</div>
<div class="tdare">
  <table width="100%" cellspacing="0" class="dataTable">
    <!--{if $goods_list}-->
    <tr class="tatr1">
      <td width="5%" class="firstCell">
        <input type="checkbox" class="checkall" />
      </td>
      {if $enable_radar}
      <td width="10%">{$lang.enable_radar}</td>
      {/if}
      <td width="5%">
        <span ectype="order_by" fieldname="goods_id">商品ID</span>
      </td>
      <td width="30%">
        <span ectype="order_by" fieldname="goods_name">{$lang.goods_name}</span>
      </td>
      <td>
        <span ectype="order_by" fieldname="price">商品价格</span>
      </td>
      <td width="10%">
        <span ectype="order_by" fieldname="store_name">{$lang.store_name}</span>
      </td>
      <td>
        <span ectype="order_by" fieldname="brand">{$lang.brand}</span>
      </td>
      <td>
        <span ectype="order_by" fieldname="cate_id">{$lang.gcategory}</span>
      </td>
      <td class="table-center">
        <span ectype="order_by" fieldname="is_cheap">特价</span>
      </td>
      <td class="table-center">
        <span ectype="order_by" fieldname="is_hot">{$lang.is_hot}</span>
      </td>
      <td class="table-center">
        <span ectype="order_by" fieldname="if_show">{$lang.if_show}</span>
      </td>
      <td class="table-center">
        <span ectype="order_by" fieldname="closed">{$lang.close}</span>
      </td>
      <td>
        <span ectype="order_by" fieldname="views">{$lang.views}</span>
      </td>
      <td>
        <span ectype="order_by" fieldname="last_update">修改时间</span>
      </td>
      <td>{$lang.handler}</td>
    </tr>
    <!--{/if}-->
    <!--{foreach from=$goods_list item=goods}-->
    <tr class="tatr2">
      <td class="firstCell">
        <input type="checkbox" class="checkitem" value="{$goods.goods_id}"/>
      </td>
      {if $enable_radar}
      <td>
        <span id="r{$goods.goods_id}"class="radar_product_point" radar_price="{$goods.shop_price}" radar_product_id='{$goods.goods_id}' radar_brand="{$goods.brand_name}"  radar_catname="{$goods.cat_name}" radar_sn="{$goods.goods_sn}" radar_keyword="" radar_name="{$goods.goods_name|escape:html}"></span>
      </td>
      {/if}
      <td>{$goods.goods_id}</td>
      <td>
        <span ectype="inline_edit" fieldname="goods_name" fieldid="{$goods.goods_id}" required="1" class="editable" title="{$lang.editable}">{$goods.goods_name|escape}</span>
      </td>
      <td>{$goods.price|price}</td>
      <td>{$goods.store_name|escape}</td>
      <td>{$goods.brand|escape}</td>
      <td>{$goods.cate_name|nl2br}</td>
      <td class="table-center">
        <!--{if $goods.is_cheap}-->
        <img src="templates/style/images/positive_enabled.gif" ectype="inline_edit" fieldname="is_cheap" fieldid="{$goods.goods_id}" fieldvalue="1" title="{$lang.editable}"/>
        <!--{else}-->
        <img src="templates/style/images/positive_disabled.gif" ectype="inline_edit" fieldname="is_cheap" fieldid="{$goods.goods_id}" fieldvalue="0" title="{$lang.editable}"/>
        <!--{/if}--> </td>
      <td class="table-center">
        <!--{if $goods.is_hot}-->
        <img src="templates/style/images/positive_enabled.gif" ectype="inline_edit" fieldname="is_hot" fieldid="{$goods.goods_id}" fieldvalue="1" title="{$lang.editable}"/>
        <!--{else}-->
        <img src="templates/style/images/positive_disabled.gif" ectype="inline_edit" fieldname="is_hot" fieldid="{$goods.goods_id}" fieldvalue="0" title="{$lang.editable}"/>
        <!--{/if}--> </td>
      <td class="table-center">
        <!--{if $goods.if_show eq 1}-->
        <img src="{res file=style/images/positive_enabled.gif}" ectype="inline_edit" fieldname="if_show" fieldid="{$goods.goods_id}" fieldvalue="1" title="{$lang.editable}" />
        <!--{elseif $goods.if_show eq 0}-->
        <img src="{res file=style/images/positive_wait.gif}" ectype="inline_edit" fieldname="if_show" fieldid="{$goods.goods_id}" fieldvalue="0" title="{$lang.editable}" />
        <!--{elseif $goods.if_show eq 2}-->
        <img src="{res file=style/images/positive_disabled.gif}" title="不可编辑" />
        <!-- {/if} --> </td>
      <td class="table-center">
        <!--{if $goods.closed} -->
        <img src="{res file=style/images/negative_enabled.gif}" ectype="inline_edit" fieldname="closed" fieldid="{$goods.goods_id}" fieldvalue="1" title="{$lang.editable}"/>
        <!--{else}-->
        <img src="{res file=style/images/negative_disabled.gif}" ectype="inline_edit" fieldname="closed" fieldid="{$goods.goods_id}" fieldvalue="0" title="{$lang.editable}"/>
        <!-- {/if} --> </td>
      <td>{$goods.views|default:0}</td>
      <td>{$goods.last_update|date:complete}</td>
      <td>
        <a id="review" target="_blank" href="{$site_url}/index.php?app=check_goods&amp;id={$goods.goods_id}">{$lang.review}</a>
        <!--{if !$goods.is_feature}-->
        <a href="javascript:void(0)" class="feature_btn mgt5" goods_id="{$goods.goods_id}" goods_name="{$goods.goods_name|escape}">特色商品</a>
        <!--{/if}--> 
        <br />
        <a href="index.php?app=goods&act=recommend_to_place&amp;goods_id={$goods.goods_id}">推向场景分类</a>
      </td>
    </tr>
    <!--{foreachelse}-->
    <tr class="no_data info">
      <td colspan="8">{$lang.no_data}</td>
    </tr>
    <!--{/foreach}--> </table>
  <!--{if $goods_list}-->
  <div id="dataFuncs">
    <div id="batchAction" class="left paddingT15">
      <!--{if !$smarty.get.closed}-->
      <input class="formbtn batchButton" type="button" value="{$lang.recommend}" name="id" uri="index.php?app=goods&act=recommend&ret_page={$page_info.curr_page}" />
      &nbsp;&nbsp;
      <!--{/if}-->
      <input class="formbtn batchButton" type="button" value="{$lang.edit}" name="id" uri="index.php?app=goods&act=edit&ret_page={$page_info.curr_page}" />
      &nbsp;&nbsp;
      <input class="formbtn batchButton" type="button" value="分类编辑" name="id" uri="index.php?app=goods&act=edit_category&ret_page={$page_info.curr_page}" />
      &nbsp;&nbsp;
      <input class="formbtn batchButton" type="button" value="{$lang.drop}" name="id" uri="index.php?app=goods&act=drop&ret_page={$page_info.curr_page}" presubmit="confirm('{$lang.drop_confirm}')" />
      &nbsp;&nbsp;
      <input class="batchButton" type="button" value="撤销场景分类商品" name="id" uri="index.php?app=goods&act=revoked_place_goods&placecate_id={$smarty.get.placecate_id}" presubmit="confirm('您确定要撤销场景分类商品吗（不可恢复）？')" />
    </div>
    <div class="pageLinks">{include file=page.bottom.html}</div>
    <!--{/if}--> </div>
  <div class="clear"></div>
</div>
<div class="feature-wrap" id="feature_wrap"></div>
<script type="text/html" id="feature_cont">
  <h2>新增特色商品</h2>
  <a href="javascript:void(0)" class="close_btn">X</a>
  <form action="" method="post">
    <table class="infoTable">
      <tr>
        <td width="70" height="40"><i>*</i> 特色标题：</td> 
        <td>
          <input type="text" name="title" class="txt" id="title" />
        </td>
      </tr>
      <tr>
        <td height="40"><i>&nbsp;</i> 排序：</td>
        <td>
          <input type="text" name="sort" value="255" class="txt" />
        </td>
      </tr>
      <tr>
        <td align="right" height="50">&nbsp;</td>
        <td>
          <input class="formbtn mgr10" type="submit" id="feature_submit" name="Submit" value="提交" />
          <input class="formbtn" type="reset" name="reset" value="重置" />
        </td>
      </tr>
    </table>
  </form>
</script>
<script type="text/javascript">
  $(function(){
    var html=$('#feature_cont').html();
    jQuery.each($('.feature_btn'),function(){
        $(this).bind('click',function(){
            var goods_id=$(this).attr('goods_id');
            var goods_name=$(this).attr('goods_name');
            var $this=$(this);
            $('#feature_wrap').html(html);
            $('#feature_wrap').find('#title').val(goods_name);
            jQuery('#feature_wrap').children('.close_btn').bind('click',function(){
                admin.hidePop({'id':'#feature_wrap'});
            });
            jQuery('#feature_wrap').children('form').submit(function(){
              var serializeData=$(this).serialize();
              $.get('index.php?app=goods&act=ajax_add_feature'+'&goods_id='+goods_id+'&'+serializeData,function(data){
                  admin.hidePop({'id':'#feature_wrap'});
                  var jdata=eval('('+data+')');
                  if(jdata.done){
                    $this.hide();
                  }else{
                    admin.sConfirm({'info':jdata.msg,'cancel':true});
                  }
              },'json');
              return false;
            });
            admin.showPop({'id':'#feature_wrap','maxWrap':document});

        });
    });
});
</script>
{include file="footer.html"}
{if $enable_radar}
<input type="hidden" id="radar_lincense_id" value="" />
<input type="hidden" id="radar_product_key" value="ecmall" />
<input type="hidden" id="radar_sign_key" value="" />
<script type="text/javascript" src="http://js.sradar.cn/radarForGoodsList.js"></script>
<script>
$(function(){
    radar_point_extract();
});
</script>
{/if}